let num : number;
num = 123;
console.log(num);

let num1 : number = 789;
console.log(num1);

let str1 : string = 'abc';
let str2 : string = 'efd';
let str3 : string;
str3 = str1 + num1;
console.log(str1,str2,str3);

let bool1 : boolean = true;
console.log(bool1);

let str4 : string, num4 : number, bool4 : boolean;
str4 = '123';
num4 = 123;
bool4 = false;
console.log(str4,num4,bool4);


let bool3 =false;
bool3 = true;
console.log(bool3);

let aa :'wo';
aa = 'wo';
console.log(aa);


let bb :'hhh' | 'hello' | 'hai' | false;
bb = 'hhh';
console.log(bb);

let cc : any;
cc = 666;
let dd : string;
dd = cc;
console.log(cc);
console.log(dd);

let ee :unknown;
ee = 999;
ee = false;
let ff : string;
let gg :unknown;
gg = ee;
console.log(ee);

function sum (a:number,b:number):number {
    return a+ b;
}
function foo(a:number,b:string):string{
    return a+b 
}
console.log(foo(1234,'abc'));


function fun1 (a:string,b:number):void {
    let c:string = a+b;
    console.log(c);
    
}
console.log(fun1('ddd',111));


let obj:{name:string,age:number};
obj = {
    name:'tom',
    age:20,
}
console.log(obj);


let obj2:{name:string,age:number,sex?:string};

obj2 = {
    name:'lili',
    age:19
}
console.log(obj2);

let obj3 :{name:string,age:number,[propName:string]:unknown};
obj3 = {
    name:'join',
    age:18,
    sex:'女',
    height:180,
}
obj3.weight = 90;
console.log(obj3);

let arr:string[];
arr = ['st','greg','gerg'];

let arr1 : number[];
arr1 = [1,2,3]

let arr3 :Array<number>;
arr3 = [1,2,3];
let arr4 :Array<string>;
arr4 = ['fei','pao','tiao'];

let arr5 :[string,number,boolean];
arr5 = ['000',333,false];
console.log(arr5);

enum Color {
    Yellow,
    Pink,
    Blue
}
let monkey : Color = Color.Pink;
console.log(monkey,Color.Yellow,Color.Blue);
console.log(Color[0],Color[1],Color[2]);

enum Color1 {
    Yellow = 5,
    Pink,
    Blue
}
console.log(Color1[5],Color1.Blue,Color1['pink']);


let uu :'liu' | 'li' | 'dong' | 345;
uu = 'liu';
uu = 'li';
function boo(a:string | number, b:number) : void {
    console.log(a,b);
    
}
boo(12,21);

enum ObjTest {
    Liu,
    Li,
    Dong
}
console.log(ObjTest['Liu']);
console.log(ObjTest[0]);

enum ObjTest1 {
    Liu = 11,
    Li,
    Dong
}
console.log(ObjTest1['Liu']);


function bunn(x:number | string | false) {
    if((<string>x).length) {
        console.log(111);
        return (<string>x).length;
        
    }else {
        console.log(222);
        return x.toString().length;
        
    }
}
console.log(bunn(false));


function bunn1(x : number | string | false) {
    if((x as string).length){
        console.log(111);
        return (<string>x).length;
        
    }else {
        console.log(222);
        return x.toString().length;
        
    }
}
console.log(bunn1(false));


let apple = 'apple';

let apple1;
apple1 = 987;
apple1 = 'greg';